
    function setTreeData(list) {
        list.forEach(function (i) {
          delete i.children;
        });
        let map = {};
        list.forEach((it) => {
          map[it.id] = it;
        });
        let treeData = [];
        list.forEach((child) => {
          const mapItem = map[child.parent_id];
          if (mapItem) {
            (mapItem.children || (mapItem.children = [])).push(child);
          } else {
            treeData.push(child);
          }
        });
        return treeData;
      }

export default setTreeData
